#!/usr/bin/env bash
set -euo pipefail

SRC="thread_limit_probe.cpp"
BIN="thread_limit_probe"
WAIT_SECONDS=5

echo "正在编译 ${SRC} ..."
g++ -std=c++17 -O2 -pthread "${SRC}" -o "${BIN}"

echo "运行 ${BIN} ..."
./"${BIN}"

echo "等待 ${WAIT_SECONDS} 秒后删除可执行文件 ..."
sleep "${WAIT_SECONDS}"

echo "删除 ${BIN} ..."
rm -f "${BIN}"

echo "完成。"